﻿using System;
using NUnit.Framework;

namespace CSSpec
{
    /// <summary>
    /// The base class for a the CSSpec Framework.
    /// </summary> 
    public abstract class CSSpecFixture<TTestStateObject> where TTestStateObject : new()
    {
        /// <summary>
        /// Creates an instance of the provided TestStateObject and invokes the provided method.
        /// </summary> 
        /// <returns></returns>
        public virtual StatePersister<TTestStateObject> Given(Action<TTestStateObject> given)  
        {
            var testState = new TTestStateObject();
            given(testState);
            return new StatePersister<TTestStateObject>(testState);
        }
        /// <summary>
        /// Asserts not null on local fields.
        /// </summary> 
        public void ShouldNotBeNull(object target)
        {
            Assert.IsNotNull(target);
        }

        /// <summary>
        /// Asserts null on local fields.
        /// </summary> 
        public void ShouldBeNull(object target)
        {
            Assert.IsNull(target);
        }
    }
}
